package Cantella::DJabberd::Web::UI::Widget::User::Auth;

use Reaction::UI::WidgetClass;

class Auth, which {

  implements fragment login_logout_form {
    if( $_{viewport}->has_current_user ){
      arg user_display_name => $_{viewport}->current_user->display_name;
      render 'logout_form_layout'
    } else {
      render 'login_form_layout'
    }
  };

  implements fragment login_form {
    arg '_' => $_{viewport}->login_form;
    render 'viewport';
  };

  implements fragment logout_form {
    arg '_' => $_{viewport}->logout_form;
    render 'viewport';
  };

};

1;
